Skip to content

Conversation

@NucleonGodX
Copy link
Contributor

Fixes #1794
This PR adds support for scorecard based compliance using the new refactored architecture created in #1799
The scorecard compliance alert is stored in project's extra data and fetched from there to be visible in UI and during check-compliance command, The alert is computed during the fetch_score pipeline.

Once #1799 is merged, I will rebase this PR to main to remove the previous commits.

Signed-off-by: NucleonGodX <[email protected]>
Signed-off-by: NucleonGodX <[email protected]>
Signed-off-by: NucleonGodX <[email protected]>
@tdruez
Copy link
Contributor

tdruez commented Aug 4, 2025

Once #1799 is merged, I will rebase this PR to main to remove the previous commits.

You can now merge main ;)

Signed-off-by: NucleonGodX <[email protected]>
Copy link
Contributor

@tdruez tdruez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, see various comments before the merge.
Also, could you add an entry in the CHANGELOG?

return Response({"license_clarity_compliance_alert": clarity_alert})

@action(detail=True, methods=["get"])
def scorecard_compliance(self, request, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a new entry in the REST API documentation, see _rest_api_license_clarity_compliance

Comment on lines 72 to 84
if scorecard_policy and scorecard_data.score is not None:
try:
score = float(scorecard_data.score)
alert = scorecard_policy.get_alert_for_score(score)
except Exception:
alert = "error"

order = {"ok": 0, "warning": 1, "error": 2}
if worst_alert is None or order[alert] > order.get(worst_alert, -1):
worst_alert = alert

if worst_alert is not None:
self.project.update_extra_data({"scorecard_compliance_alert": worst_alert})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this new logic should be moved to a pipe function. We want to keep the pipeline method a simple as possible. This would also make it easier to test (make sure to add one).

Copy link
Contributor

@tdruez tdruez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Merging.


v35.2.0 (2025-08-01)
--------------------
- Enhanced scorecard compliance support with:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be inside the v35.2.0 section since it is already released.

@tdruez tdruez merged commit 7a98ebc into aboutcode-org:main Aug 11, 2025
10 checks passed
aayushkdev pushed a commit to aayushkdev/scancode.io that referenced this pull request Aug 28, 2025
aayushkdev added a commit to aayushkdev/scancode.io that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add scorecard based compliance support

2 participants